Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish the smithy-json deserializer codegen #530

Merged
merged 4 commits into from
Jun 23, 2021

Conversation

jdisanti
Copy link
Collaborator

Fixes #161. This is the last of the JSON refactor.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@jdisanti jdisanti requested a review from rcoh June 22, 2021 22:42
Copy link
Collaborator

@rcoh rcoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! there is also more code you can delete—we don't use synthetic body anymore so that can be deleted from operation normalizer

}
}
override fun additionalHeaders(operationShape: OperationShape): List<Pair<String, String>> =
listOf("X-Amz-Target" to "${protocolConfig.serviceShape.id.name}.${operationShape.id.name}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be x-amz-target so that hyper doesn't need to re-case it for us

"Ok(body) => #1T { kind: #1TKind::$variantName(body), meta: generic },",
errorSymbol
override fun parseGenericError(operationShape: OperationShape): RuntimeType {
return RuntimeType.forInlineFun("parse_generic_error", "json_deser") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you can have this be a single Rust block which is typically a little easier to read

@jdisanti jdisanti requested a review from rcoh June 23, 2021 00:58
Copy link
Collaborator

@rcoh rcoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

operation: OperationShape,
outputBodyFactory: StructureModifier
): List<StructureShape> {
private fun syntheticOutputShapes(operation: OperationShape): List<StructureShape> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this just be StructureShape? now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in this particular case, the code is actually cleaner with them being lists since the code that calls these functions is pretty clean that way, even if they only ever have one element. I would have to convert them at the call sites otherwise.

operation: OperationShape,
inputBodyFactory: StructureModifier
): List<StructureShape> {
private fun syntheticInputShapes(operation: OperationShape): List<StructureShape> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here re: StructureShape?

@jdisanti jdisanti merged commit 72d680d into smithy-lang:main Jun 23, 2021
@jdisanti jdisanti deleted the json-de-cleanup branch June 23, 2021 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hide Serialize/Deserialize implementations
2 participants